home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 May: Tool Chest / Developer CD Series May 1996 (Tool Chest) (Apple Computer) (1996).iso / Tool Chest / Development Tools & Languages / Dylan Related / Mindy / Mindy 1.2 - portable sources / libraries / streams / library.dylan < prev    next >
Encoding:
Text File  |  1995-03-15  |  4.9 KB  |  183 lines  |  [TEXT/ttxt]

  1. module: Dylan-User
  2. author: chiles@cs.cmu.edu
  3. synopsis: This file defines the Streams library and its modules.
  4. copyright: See below.
  5. rcs-header: $Header: library.dylan,v 1.18 94/11/16 13:18:29 chiles Exp $
  6.  
  7. //======================================================================
  8. //
  9. // Copyright (c) 1994  Carnegie Mellon University
  10. // All rights reserved.
  11. // 
  12. // Use and copying of this software and preparation of derivative
  13. // works based on this software are permitted, including commercial
  14. // use, provided that the following conditions are observed:
  15. // 
  16. // 1. This copyright notice must be retained in full on any copies
  17. //    and on appropriate parts of any derivative works.
  18. // 2. Documentation (paper or online) accompanying any system that
  19. //    incorporates this software, or any part of it, must acknowledge
  20. //    the contribution of the Gwydion Project at Carnegie Mellon
  21. //    University.
  22. // 
  23. // This software is made available "as is".  Neither the authors nor
  24. // Carnegie Mellon University make any warranty about the software,
  25. // its performance, or its conformity to any specification.
  26. // 
  27. // Bug reports, questions, comments, and suggestions should be sent by
  28. // E-mail to the Internet address "gwydion-bugs@cs.cmu.edu".
  29. //
  30. //======================================================================
  31. //
  32.  
  33.  
  34. ///
  35. /// These definitions go into the Dylan-User module because this is how we
  36. /// jumpstart a library.
  37. ///
  38.  
  39. define library streams
  40.   use dylan;
  41.   export streams, standard-io;
  42. end library;
  43.  
  44.  
  45. /// The Internals Module exports everything that is necessary to make the
  46. /// code in the Streams Module run, but only stuff that is of an internals
  47. /// nature to a Dylan implementation.
  48. ///
  49. define module internals
  50.   use dylan;
  51.   use extensions,
  52.     import: {<boolean>, <byte-character>, <byte-vector>, <fixed-integer>,
  53.          $maximum-fixed-integer, one-of, type-or, false-or, ignore,
  54.          on-exit},
  55.     export: all;
  56.   use system,
  57.     import: {<buffer>, copy-bytes},
  58.     export: all;
  59.   use threads,
  60.     import: {<multilock>, <semaphore>, grab-lock, release-lock, locked?},
  61.     export: all;
  62.   use file-descriptors,
  63.     // This is one of two use file-descriptors clauses.  This one prefixes
  64.     // everything with "fd-"
  65.     import: {// Lseek values for whence argument.
  66.          l_set => fd-seek-start,
  67.          l_incr => fd-seek-current,
  68.          l_xtnd => fd-seek-end,
  69.  
  70.          // Open values for flags argument
  71.          o_rdonly, o_wronly, o_rdwr, o_creat, o_trunc, o_excl,
  72.  
  73.          // Open errors.
  74.          enoent, eexist},
  75.     prefix: "fd-",
  76.     export: all;
  77.   use file-descriptors,
  78.     // This is two of two use file-descriptors clauses.  This one does no
  79.     // prefixing.
  80.     import: {fd-read, fd-write, fd-open, fd-close, fd-seek,
  81.          fd-input-available?, fd-sync-output, fd-error-string},
  82.     export: all;
  83.   export
  84.     <byte>, call-fd-function;
  85. end module;
  86.  
  87. define module streams
  88.   use dylan;
  89.   use internals,
  90.     export: {<byte-vector>, <buffer>, <byte-character>, <byte>};
  91.   export
  92.     //
  93.     // Classes and types.
  94.     <stream>,
  95.     <file-stream>,
  96.     <string-input-stream>,
  97.     <byte-string-input-stream>,
  98.     <string-output-stream>,
  99.     <byte-string-output-stream>,
  100.     <buffer-index>,
  101.     //
  102.     // Constants.
  103.     $maximum-buffer-size,
  104.     //
  105.     // Conditions.
  106.     <end-of-file>,
  107.     <file-not-found>,
  108.     <file-exists>,
  109.     //
  110.     // Stream Extension Protocol.
  111.     close,
  112.     stream-extension-get-input-buffer,
  113.     stream-extension-release-input-buffer,
  114.     stream-extension-fill-input-buffer,
  115.     stream-extension-input-available-at-source?,
  116.     stream-extension-get-output-buffer,
  117.     stream-extension-release-output-buffer,
  118.     stream-extension-empty-output-buffer,
  119.     stream-extension-force-secondary-buffers,
  120.     stream-extension-synchronize,
  121.     //
  122.     // Basic I/O Protocol.
  123.     read-byte,
  124.     peek-byte,
  125.     read-line,
  126.     input-available?,
  127.     flush-input,
  128.     force-output,
  129.     synchronize-output,
  130.     //
  131.     // Buffer Access Protocol.
  132.     get-input-buffer,
  133.     release-input-buffer,
  134.     fill-input-buffer,
  135.     input-available-at-source?,
  136.     get-output-buffer,
  137.     release-output-buffer,
  138.     empty-output-buffer,
  139.     force-secondary-buffers,
  140.     synchronize,
  141.     //
  142.     // Data Extension Protocol.
  143.     read-as,
  144.     read-into!,
  145.     write,
  146.     write-line,
  147.     //
  148.     // <random-access-stream> protocol.
  149.     stream-position,
  150.     stream-position-setter,
  151.     adjust-stream-position,
  152.     stream-size,
  153.     //
  154.     // <string-output-stream> protocol.
  155.     string-output-stream-string,
  156.     //
  157.     // <buffer> protocol.
  158.     buffer-subsequence,
  159.     copy-from-buffer!,
  160.     copy-into-buffer!,
  161.     //
  162.     // Conditions operations.
  163.     end-of-file-stream,
  164.     file-not-found-filename,
  165.     file-exists-filename,
  166.     //
  167.     // Locking.
  168.     stream-locked?,
  169.     lock-stream,
  170.     unlock-stream,
  171.     //
  172.     // The following are extensions to the standard Streams Library.
  173.     <fd-stream>;
  174. end module;
  175.  
  176. define module standard-io
  177.   use dylan;
  178.   use streams,
  179.     import: {<fd-stream>};
  180.   export
  181.     *standard-input*, *standard-output*, *standard-error*;
  182. end module
  183.